from fdfs_client.client import Fdfs_client

if __name__ == '__main__':
    # 创建连接对象
    client = Fdfs_client('client.conf')
    # 上传文件
    # ret = client.upload_by_filename('/home/python/Desktop/1.jpg')
    '''
    {
        'Group name': 'group1',
        'Remote file_id': 'group1/M00/00/00/wKgvgF0AX9KAaALCAAAhg8MeEWU777.jpg',
        'Uploaded size': '8.00KB',
        'Local file name': '/home/python/Desktop/1.jpg',
        'Storage IP': '192.168.47.128',
        'Status': 'Upload successed.'
    }
    '''

    # 修改文件===>修改抛异常
    # ret=client.modify_by_filename('/home/python/Desktop/2.jpg','group1/M00/00/00/wKgvgF0AX9KAaALCAAAhg8MeEWU777.jpg')

    # 删除文件
    ret = client.delete_file('group1/M00/00/00/wKgvgF0AX9KAaALCAAAhg8MeEWU777.jpg')
    '''
    (
        'Delete file successed.',
        'group1/M00/00/00/wKgvgF0AX9KAaALCAAAhg8MeEWU777.jpg',
        '192.168.47.128'
    )
    '''

    # 响应值
    print(ret)
